<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/session.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<LINK type="text/css" rel="stylesheet" href="${ctx}/css/style.css"/>
<script type="text/javascript" src="${ctx}/js/xtable.js"></script>
<script type="text/javascript" src="${ctx}/js/xtree.js"></script>
<script type="text/javascript" src="${ctx}/js/validator.js"></script>
<script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
<script type="text/javascript" src="${ctx}/dwr/util.js"></script>
<script type="text/javascript" src="${ctx}/dwr/interface/SecurityService.js"></script>
<script type="text/javascript" src="${ctx}/js/loading.js"></script>
</head>
<body onload="init()">
<table>
    <tr>
        <td valign="top">
        <SCRIPT language="javascript" type="">
        var resourceTree = new WebFXTree(0, "资源");
        </SCRIPT>
        </td>
        <td>
        &nbsp;
        </td>
        <td valign="top">
        </td>
    </tr>
</table>
</body>
</html>
<script type="text/javascript">
function init(){
    var application = new Application();
    application.pageIndex = 1;
    application.pageSize = 100;
    SecurityService.selectApplicationResourceList(application, callbackSelectResourceList);
}
//解析返回的结果
function callbackSelectResourceList(list){
    var application;
    var resourceList;
    for(var i = 0; i < list.length; i++){
        application = list[i];
        var node = new WebFXTreeItem(application.applicationId, application.applicationName, "", null, resourceTree, false, false);
        resourceList = application.resourceList;
        addResourceNode(resourceList, node)
    }
    resourceTree.expandAll();
}

function addResourceNode(list, parentNode){
    for(var i = 0; i < list.length; i++){
        var resource = list[i];
        var node = new WebFXTreeItem(resource.resourceId, resource.resourceName, "", parentNode, resourceTree, true, false);
        var resourceList = resource.resourceList;
        if(resourceList != null && resourceList.length > 0){
            addResourceNode(resourceList, node);
        }
    }
}
//    var resourceIds = resourceTree.getCheckNodeId();

</script>
